/**********************************************************************\

 Copyright 2012 Diggory Blake

 This file is part of klip-engine

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

\**********************************************************************/
#pragma once

class kState;

#include "kbase.h"
#include "kengine.h"

class kState : public kBase {
private:
	kEngine* _engine;

public:
	inline kState(kEngine* engine) {
		_engine = engine;
	}
	inline kEngine* getEngine() {
		return _engine;
	}
	virtual void update(bool topMost, float delta) = 0;
	inline void pushState(std::function<kState* ()> state) {
		_engine->pushState(state);
	}
	inline void popState() {
		return _engine->popState();
	}
	virtual void onPushChild();
	virtual void onPopChild();
	void* operator new(size_t size);
    void operator delete(void* ptr);
};
